home *** CD-ROM | disk | FTP | other *** search
/ MacFormat España 15 / macformat_15.iso / C de cerca / Codewarrior Lite / MacOS Support / Headers / ANSI Headers / stdio.h < prev    next >
Text File  |  1995-12-29  |  4KB  |  142 lines

  1. /* stdio.h standard header */
  2. #ifndef _STDIO
  3. #define _STDIO
  4. #ifndef _YVALS
  5. #include <yvals.h>
  6. #endif
  7.  
  8. #if __MWERKS__
  9. #pragma options align=mac68k
  10.  
  11. #if __CFM68K__ && __USING_IMPORTED_ANSI__
  12. #pragma import on
  13. #endif
  14. #endif
  15.  
  16.         /* macros */
  17. #ifndef NULL
  18. #define NULL         _NULL
  19. #endif
  20. #define _IOFBF        0
  21. #define _IOLBF        1
  22. #define _IONBF        2
  23. #if !__MWERKS__
  24. #define BUFSIZ        512
  25. #else
  26. #define BUFSIZ        4096
  27. #endif
  28. #define EOF            (-1)
  29. #define FILENAME_MAX    _FNAMAX
  30. #define FOPEN_MAX        _FOPMAX
  31. #define L_tmpnam        _TNAMAX
  32. #define TMP_MAX            32
  33. #define SEEK_SET    0
  34. #define SEEK_CUR    1
  35. #define SEEK_END    2
  36. #define stdin        (&_Stdin)
  37. #define stdout        (&_Stdout)
  38. #define stderr        (&_Stderr)
  39.         /* type definitions */
  40. #ifndef _SIZET
  41. #define _SIZET
  42. typedef _Sizet size_t;
  43. #endif
  44. typedef _Fpost fpos_t;
  45. typedef struct _Filet {
  46.     unsigned short _Mode;
  47.     short _Handle;
  48.     unsigned char *_Buf, *_Bend, *_Next;
  49.     unsigned char *_Rend, *_Wend, *_Rback;
  50.     _Wchart *_WRback, _WBack[2];
  51.     unsigned char *_Rsave, *_WRend, *_WWend;
  52.     struct _Mbstatet _Wstate;
  53.     char *_Tmpnam;
  54.     unsigned char _Back[2], _Cbuf;
  55.     } FILE;
  56.         /* declarations */
  57. _C_LIB_DECL
  58. extern FILE _Stdin, _Stdout, _Stderr;
  59. void clearerr(FILE *); int fclose(FILE *); int feof(FILE *);
  60. int ferror(FILE *); int fflush(FILE *); int fgetc(FILE *);
  61. int fgetpos(FILE *, fpos_t *);
  62. char *fgets(char *, int, FILE *);
  63. FILE *fopen(const char *, const char *);
  64. int fprintf(FILE *, const char *, ...);
  65. int fputc(int, FILE *); int fputs(const char *, FILE *);
  66. size_t fread(void *, size_t, size_t, FILE *);
  67. FILE *freopen(const char *, const char *, FILE *);
  68. int fscanf(FILE *, const char *, ...);
  69. int fseek(FILE *, long, int);
  70. int fsetpos(FILE *, const fpos_t *); long ftell(FILE *);
  71. size_t fwrite(const void *, size_t, size_t, FILE *);
  72. char *gets(char *);
  73. void perror(const char *); int printf(const char *, ...);
  74. int puts(const char *); int remove(const char *);
  75. int rename(const char *, const char *);
  76. void rewind(FILE *); int scanf(const char *, ...);
  77. void setbuf(FILE *, char *);
  78. int setvbuf(FILE *, char *, int, size_t);
  79. int sprintf(char *, const char *, ...);
  80. int sscanf(const char *, const char *, ...);
  81. FILE *tmpfile(void); char *tmpnam(char *);
  82. int ungetc(int, FILE *);
  83. int vfprintf(FILE *, const char *, _Va_list);
  84. int vprintf(const char *, _Va_list);
  85. int vsprintf(char *, const char *, _Va_list);
  86. long _Fgpos(FILE *, fpos_t *);
  87. int _Flocale(FILE *, const char *, int);
  88. void _Fsetlocale(FILE *, int);
  89. int _Fspos(FILE *, const fpos_t *, long, int);
  90. int putc(int, FILE *); int putchar(int);
  91. extern FILE *_Files[FOPEN_MAX];
  92. _END_C_LIB_DECL
  93. #ifdef __cplusplus
  94.         /* inlines, for C++ */
  95. inline int getc(FILE *_Str)  {return ((_Str->_Next
  96.     < _Str->_Rend ? *_Str->_Next++ : fgetc(_Str))); }
  97. inline int getchar()  {return ((_Files[0]->_Next
  98.     < _Files[0]->_Rend ? *_Files[0]->_Next++ : fgetc(_Files[0]))); }
  99. /*
  100. inline int putc(int _C, FILE *_Str)  {return ((_Str->_Next
  101.     < _Str->_Wend ? (*_Str->_Next++ = _C) : fputc(_C, _Str))); }
  102. inline int putchar(int _C)  {return ((_Files[1]->_Next
  103.     < _Files[1]->_Wend ? (*_Files[1]->_Next++ = _C)
  104.         : fputc(_C, _Files[1]))); }
  105. */
  106. #else
  107.         /* declarations and macro overrides, for C */
  108. int getc(FILE *); int getchar(void);
  109. #define getc(str)    ((str)->_Next < (str)->_Rend \
  110.     ? *(str)->_Next++ : (fgetc)(str))
  111. #define getchar()    (_Files[0]->_Next < _Files[0]->_Rend \
  112.     ? *_Files[0]->_Next++ : (fgetc)(_Files[0]))
  113. /*
  114. #define putc(c, str)    ((str)->_Next < (str)->_Wend \
  115.     ? (*(str)->_Next++ = c) : (fputc)(c, str))
  116. #define putchar(c)    (_Files[1]->_Next < _Files[1]->_Wend \
  117.     ? (*_Files[1]->_Next++ = c) : (fputc)(c, _Files[1]))
  118. */
  119. #endif /* __cplusplus */
  120.  
  121. #if __MWERKS__
  122. #if __CFM68K__ && __USING_IMPORTED_ANSI__
  123. #pragma import reset
  124. #endif
  125.  
  126. #pragma options align=reset
  127. #endif
  128.  
  129. #endif /* _STDIO */
  130.  
  131. /*
  132.  * Copyright (c) 1994 by P.J. Plauger.  ALL RIGHTS RESERVED. 
  133.  * Consult your license regarding permissions and restrictions.
  134.  */
  135.  
  136. /* Change log:
  137.  *94June04 PlumHall baseline
  138.  *94Sept30 Applied diffs for Thu Aug 25 23:13:15 1994
  139.  *94Oct07 Inserted MW changes.
  140.  *94Oct12mm Set MWs BUFSIZ to 4096
  141.  */
  142.